<template>
  <div>home页面</div>
  <button @click="fn">跳转到关于页</button>
</template>

<script>
import { useRouter } from "vue-router";

export default {
  setup() {
    // router就是路由实例
    // use开头的函数成为hooks，它只能在setup的顶层调用
    const router = useRouter();

    const fn = () => {
      // const router = useRouter();
      router.push("/about/456");
    };

    return { fn };
  },
};
</script>
